# -*- coding: UTF-8 -*-                                                         
                                                                                
import base                                                                     
import xml.etree.ElementTree as et                                              
                                                                                
class Imageshack(base.Core):                                                    
                                                                                
    __label__ = "pic.co.ua"                                                 
    __url__ = "www.pic.co.ua"                                               
                                                                                
    def uploadFile(self, image):                                                
        params = {"file": open(image, "rb"), "xml":'yes'}                       
        f = self.opener.open("http://pic.co.ua/source/image_add.php", params)   
        data = f.read()                                                         
        f.close()                                                               
        return data                                                             
                                                                                
    def response(self, data):                                                   
        if data == 'failed':                                                    
            return "XML return failed"                                          
        xml = et.XML(data)          